package com.zabra.zl.ui.buy;

import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zabra.zl.R;
import com.zabra.zl.data.DetailsDealBean;

import java.util.List;

public class Adp extends BaseQuickAdapter<DetailsDealBean.PositionsBean, BaseViewHolder> {
    public Adp(int layoutResId, @Nullable List<DetailsDealBean.PositionsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, DetailsDealBean.PositionsBean item) {
        helper.setText(R.id.item_name, item.getSharesName())
                .setText(R.id.item_nowprice, item.getNowPrice())
                .setText(R.id.item_code, item.getSharesCode())
                .setText(R.id.item_buyprice, item.getBuyPrice())
                .setText(R.id.item_haved, item.getNowNum() + "")
                .setText(R.id.item_yingkui, item.getEarnAmt())
                .setText(R.id.item_yinkuibi, item.getEarnAmtRatio()+"")
                .setTextColor(R.id.item_yingkui, item.getEarnAmt().contains("-") ? Color.parseColor("#06b96a") : Color.parseColor("#ff3025"))
                .setTextColor(R.id.item_yinkuibi, item.getEarnAmt().contains("-") ? Color.parseColor("#06b96a") : Color.parseColor("#ff3025"))
                .setText(R.id.item_cansell, item.getCanSellNum() + "");
    }
}
